import {useRoutes} from "react-router-dom";
import Home from "../pages/Home";
import My from "../pages/My";
import GoodsList from "../pages/GoodsList";
import Detail from "../pages/Detail";
import React from "react";
import AuthComponent from "../components/AuthComponent";

export default function (){
    return useRoutes([
        {
            path:"/",
            element:<Home/>
        },
        {
            path:"/my",
            element:(
                <AuthComponent>
                    <My/>
                </AuthComponent>
            ),
            children:[
                {
                    index:true,
                    element:<div>我的新闻列表</div>
                },{
                    path:"goodsList",
                    element:<div>我的商品列表</div>
                }
            ]
        },
        {
            path:"/goodsList/:id.php",
            element:<GoodsList/>
        },{
            path:"*",
            element:<div>404,您找的页面不存在 </div>
        },{
            path:"/detail/:id",
            element:<Detail/>
        }
    ])
}